package main

import (
	"context"
	"fmt"
	"log"
	"strconv"

	"github.com/FISCO-BCOS/go-sdk/client"
	"github.com/FISCO-BCOS/go-sdk/conf"
	"github.com/FISCO-BCOS/go-sdk/core/types"
	"github.com/ethereum/go-ethereum/common"
	//import "github.com/FISCO-BCOS/go-sdk/client"
	//"github.com/FISCO-BCOS/go-sdk/core/types"
	// Fiscomain "contracts"
)

type Input struct {
	userId    string
	fileId    string
	fileHash  string
	fileSm3   string
	fileMd5   string
	timestamp string
}

func main() {
	configs, err := conf.ParseConfigFile("config.toml")
	if err != nil {
		log.Fatal(err)
	}
	config := &configs[0]

	client, err := client.Dial(config)
	if err != nil {
		log.Fatal(err)
	}
	var receipt *types.Receipt
	contractAddress := common.HexToHash("0x94f62f64b0d3cdba00777c85ba3724a20d2e8b7bf621cb5f2d5e66fbd0a5275f")
	receipt, err = client.GetTransactionReceipt(context.Background(), contractAddress)
	if err != nil {
		log.Fatal(err)
	}
	DecBlockNum, err := strconv.ParseInt(receipt.BlockNumber[2:], 16, 64)

	fmt.Println("BlockHash:" + receipt.BlockHash)
	fmt.Println("BlockNumber:" + strconv.Itoa(int(DecBlockNum)))
}
